<% 
    var headContent = {
  %>
  <style type="text/css">
  .tr-selected {
    background-color: #fcb287;
    border: 1px solid #fcb287;
  </style>
  <script type="text/javascript">
   $(function(){
      $("body").on('click', '.list-item', function() {
       $(".list-item").removeClass("tr-selected");
       $(this).addClass('tr-selected');
      });
      $("body").on('click', '#searchBtn', function() {
        var keywords = {
           keyword:$("#keyword").val(),
           queryType:$("#queryType").val()
        }
        var url = "${base}/businessAuthConfig/dialogStore?keywords="+JSON.stringify(keywords);
        document.location.href=url;
      });
       //当本页面属于其他页面的弹出页面时
       if (frameElement != null && frameElement.api != null) {
        var api = frameElement.api;
        api.button({
          id: 'valueOk',
          name: '确定',
          focus: true,
          callback: function () {
            var selectItems = $(".tr-selected");
            if (selectItems.length < 1) {
              alert("您没有选择任何数据！");
              return false;
            } else {
              //W = api.opener;
              //var parant = W.document.getElementById("callback");//调用父窗体元素
              var backdata = [];
             for (var i = 0; i < selectItems.length; i++) {
              var tr= selectItems[i];
              var store = {};
              store.id=$(tr).data("id");
              store.NumCode=$(tr).data("NumCode");
              store.DisplayName=$(tr).data("DisplayName");
              store.Man=$(tr).data("Man");
              backdata.push(store);
             };
             console.info(backdata);
              if (api.data != 'undefined') {
                api.data(backdata);
              }
              return true;
            }
          }
        }, { id: 'valueCancel', name: '取消' });
      }            
   });
   </script>
  <%
};
%>
<%layout("/common/_layout.html",{head:headContent}){ %>
  <%#ajax userTable:{%>
  <div class="am-g">
     <div class="am-u-sm-6">&nbsp; </div>
     <div class="am-u-sm-3">
       <select id="queryType" name="queryType" data-am-selected="{btnSize: 'sm'}">
         <option <%if (isEmpty(queryType)||queryType=="fuzzy"){%>
                     selected = "selected"
                  <%}%> value="fuzzy">模糊查询</option>
         <option <%if (!isEmpty(queryType) && queryType=="exact"){%>
                     selected = "selected"
                  <%}%> value="exact">精确查询</option>
       </select>
     </div>
     <div class="am-u-sm-3">
       <div class="am-input-group am-input-group-sm">        
         <input type="text" class="am-form-field"  style="width: 130px;" id="keyword" placeholder="渠道编码或名称" value="${keyword!}">
         <span class="am-input-group-btn">
           <button class="am-btn am-btn-default" type="button" id="searchBtn" >搜索</button>
         </span>
       </div>
     </div>
   </div>


   <div class="am-g">
     <div class="am-u-sm-12">
         <table class="am-table table-main">
             <thead>
                 <tr>
                     <th>ID</th>
                     <th>渠道编码</th>
                     <th>名称</th>
                     <th>联系人</th>
                 </tr>
             </thead>
          <tbody>
             <%for(list in pager.list!){%>
                <tr class="list-item" data-id="${list.id}" data-DisplayName="${list.DisplayName!''}" data-NumCode="${list.NumCode!''}" data-Man="${list.Man!''}">
                 <td>${list.id!}</td>
                 <td>${list.NumCode!}</td>
                 <td>${list.DisplayName!}</td>
                 <td>${list.Man!}</td>    
               </tr>
             <%}%> 
          </tbody>
       </table>
        <div class="am-cf">
           <!-- 分页 -->
           <%if (pager.list.~size > 0){%>
               <div class="am-fr">
                   <% include("/admin/business_auth_config_dialog_pager.tpl"){}%>
               </div>
           <%}else{%>
               <div class="am-kai">
                 <h3>没有找到任何记录!</h3>
               </div>
           <%}%>
        </div>
       <%}%>
     </div>
   </div>
   
<%}%>
